<template>
  <div class="app-container">
    <el-card>
      <el-row :gutter="20">
        <el-col :span="6" :xs="24">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>个人信息</span>
            </div>
            <div>
              <ul class="list-group list-group-striped">
                <li class="list-group-item">
                  登录名称
                  <div class="pull-right">{{ user.loginName }}</div>
                </li>
                <li class="list-group-item">
                  真实姓名
                  <div class="pull-right">{{ user.realName }}</div>
                </li>
                <li class="list-group-item">
                  手机号码
                  <div class="pull-right">{{ user.phone }}</div>
                </li>
                <li class="list-group-item">
                  用户邮箱
                  <div class="pull-right">{{ user.email }}</div>
                </li>
              </ul>
            </div>
          </el-card>
        </el-col>
        <el-col :span="18" :xs="24">
          <el-card>
            <div slot="header" class="clearfix">
              <span>基本资料</span>
            </div>
            <el-tabs v-model="activeTab">
              <el-tab-pane label="基本资料" name="userinfo">
                <userInfo :user="user"/>
              </el-tab-pane>
              <el-tab-pane label="修改密码" name="resetPwd">
                <resetPwd :user="user"/>
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
import {getUserInfo} from "@/api/user";
import resetPwd from "@/views/Profile/resetPwd";
import userInfo from "@/views/Profile/userInfo";

export default {
  name: "index",
  components: {
    resetPwd,
    userInfo
  },
  data() {
    return {
      user: {},
      roleGroup: {},
      postGroup: {},
      activeTab: "userinfo"
    };
  },
  created() {
    this.getUser();
  },
  methods: {
    getUser() {
      getUserInfo().then(res => {
        console.log(res)
        this.user = res.data;
      });
    }
  }
}
</script>

<style scoped>

</style>
